package dao;

import java.util.ArrayList;
import java.util.List;

import entities.Product;

public class ProductDaoMock implements ProductDao {
	private ArrayList<Product> producten;
	private static ProductDaoMock instance;

	private ProductDaoMock() {
		producten = new ArrayList<Product>();
		Product p1 = new Product();
		p1.setAll(1, 19.95, "Product1");
		Product p2 = new Product();
		p2.setAll(1, 19.95, "Product2");
		Product p3 = new Product();
		p3.setAll(1, 19.95, "Product3");
		Product p4 = new Product();
		p4.setAll(1, 19.95, "Product4");
		producten.add(p1);
		producten.add(p2);
		producten.add(p3);
		producten.add(p4);
	}

	public static ProductDaoMock getInstance() {
		if (instance == null) {
			instance = new ProductDaoMock();
		}
		return instance;
	}

	@Override
	public List<Product> getProducten(String productSoort) {
		if (productSoort == null) {
			return producten;
		}
		return new ArrayList<Product>();
	}

	@Override
	public Product getProduct(int productCode) {
		for (Product p : producten) {
			if (p.getProductCode() == productCode) {
				return p;
			}
		}
		return null;
	}
}
